package com.www.dao.admin;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.www.domain.admin.Log;

/**
 * 系统日志类dao
 */
@Repository
public interface LogDao {
	/*
	 * 日志插入操作
	 */
	@Insert("insert into log(id,content,createTime) values(default,#{content},#{createTime})")
	public int add(Log log);
	
	/*
	 * 日志信息搜索查询
	 */
	@Select({"<script>" +
			"select * from log " +
			"<if test='content != null'> where content like '%${content}%'</if>" +
			"<if test='offset != null and pageSize != null'> limit #{offset},#{pageSize}</if>" +
		"</script>"})
	public List<Log> findList(Map<String, Object> queryMap);
	
	/*
	 * 模糊搜索总条数
	 */
	@Select({"<script>" +
			"select count(*) from log " +
			"<if test='content != null'> where content like '%${content}%'</if>" +
		"</script>"})
	public int getTotal(Map<String, Object> queryMap);
	
	/*
	 * 删除日志信息
	 */
	@Delete("delete from log where id in(${value})")
	public int delete(String ids);
}
